<template>
  <ActivityPhonePreview>
    <div class="mobile_box">
      <div class="white_box">
        <div class="title_box">
          <el-icon><ArrowLeftBold /></el-icon>
          <div class="title_r">产品详情</div>
        </div>
        <el-scrollbar height="550px">
          <div class="product_pic">
            <el-image class="img_right" :src="productPopupData?.images" style="width: 100%">
              <template #error>
                <el-image src="/static/file/pic.png" style="width: 100%"></el-image>
              </template>
            </el-image>
          </div>
          <div style="padding: 0 12px">
            <div class="product_information">
              <div>{{ productPopupData?.product_name }}</div>
              <div class="Price">
                <span>售价：{{ productPopupData.sale_price ? productPopupData.sale_price : productPopupData?.specificate_list?.[0]?.sale_price }}</span>
                <span>当前规格库存：{{ productPopupData.stock_qty ? productPopupData.stock_qty : productPopupData?.specificate_list?.[0]?.stock_qty }}</span>
              </div>
              <div class="specs_box">
                <div v-if="productPopupData?.specificate_list?.length !== 0" class="specs_rule">选择规格：</div>
                <div v-for="(item, index) in productPopupData.specificate_list" :key="item.id">
                  <span :class="['specs_text', index == 0 ? 'active' : '']">{{ item.options_vals }}</span>
                </div>
              </div>
            </div>
          </div>
          <div style="padding: 0 4px">
            <div class="product_describe">
              <span class="describe">产品描述</span>
              <div class="describe_text">
                {{ productPopupData?.product_desc }}
              </div>
            </div>
          </div>
        </el-scrollbar>
      </div>
    </div>
  </ActivityPhonePreview>
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue'
import ActivityPhonePreview from '../index.vue'

defineProps({
  productPopupData: {
    type: Object,
    default: () => {
      return {}
    }
  }
})

</script>

<style lang="scss" scoped>

  .mobile_box {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    box-sizing: content-box;
    width: 100%;
    border-radius: 12px;
    background-color: #f3fafb;
    margin: 0 auto;
    .white_box {
      width: 100%;
      background-color: #fff;
      // height: 840px;
    }
    .title_box {
      display: flex;
      align-items: center;
      height: 42px;
      padding-left: 8px;
      background: #fff;
      border-radius: 15px 15px 0px 0px;
      color: #000000;
      font-weight: 300;
      font-size: 14px;
      .title_r {
        flex: 0.9;
        text-align: center;
      }
    }
    .product_pic {
      display: flex;
      justify-content: center;
    }
    .product_information {
      margin-top: 8px;
      min-height: 65px;
      background: #ffffff;
      box-shadow: 0px 6px 10px 0px rgba(46, 91, 255, 0.07);
      border-radius: 4px;
      border: 1px solid #eff2ff;
      padding: 12px 12px 0;
      color: #282828;
      font-weight: 600;
      font-size: 16px;
      .Price {
        display: flex;
        justify-content: space-between;
        align-items: center;
        color: #969696;
        font-size: 14px;
        margin-top: 16px;
      }
      .specs_box {
        display: flex;
        flex-wrap: wrap;
        margin-top: 20px;
        .specs_rule {
          font-size: 14px;
          color: #969696;
          line-height: 26px;
        }
        .specs_text {
          min-width: 85px;
          height: 22px;
          background: #f7f7f7;
          border-radius: 4px;
          border: 1px solid #e3e3e3;
          font-size: 12px;
          color: #969696;
          margin: 0 8px 8px 0;
          display: flex;
          justify-content: center;
          align-items: center;
          padding: 0 4px;
        }
        .active {
          background: #eff2ff;
          color: #0081ff;
        }
      }
    }
    .product_describe {
      margin: 8px 8px 0;
      min-height: 100px;
      background: #ffffff;
      box-shadow: 0px 6px 10px 0px rgba(46, 91, 255, 0.07);
      border-radius: 4px;
      border: 1px solid #eff2ff;
      padding: 12px 12px 0;
      word-break: break-all;
      .describe {
        color: #282828;
        font-weight: 600;
        font-size: 16px;
      }
      .describe_text {
        margin-top: 10px;
        line-height: 20px;
        color: #969696;
        font-size: 14px;
      }
    }
  }
  .scroll {
    height: calc(100vh - 50px);
    overflow-y: scroll;
  }
</style>
